<?php

use Phinx\Migration\AbstractMigration;

class CreateIndexChatGlobalIdInMessageTable extends AbstractMigration
{
    public function up()
    {
        $this->table("message")
            ->addIndex(["chat_global_id"], [
                'type' => 'normal',
                'name' => 'idx_normal_chat_global_id',
            ])
            ->addIndex(["sender"], [
                'type' => 'normal',
                'name' => 'idx_normal_sender'
            ])
            ->save();
    }

    public function down()
    {
        $this->table("message")
            ->removeIndexByName("idx_normal_chat_global_id")
            ->removeIndexByName("idx_normal_sender")
            ->save();

    }
}
